package com.gjy.sb.component;

import com.gjy.sb.plugin.MyInterceptor;
import com.gjy.sb.plugin.MyInterceptor2;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.stereotype.Component;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-12-06 14:01:28
 */
@Component
public class MyBeanFactoryInvoke implements BeanDefinitionRegistryPostProcessor {
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
        RootBeanDefinition definition = new RootBeanDefinition(MyInterceptor.class);
        RootBeanDefinition definition2 = new RootBeanDefinition(MyInterceptor2.class);
        registry.registerBeanDefinition("MyInterceptor", definition);
        registry.registerBeanDefinition("MyInterceptor2", definition2);
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

    }
}
